package com.forhappy.light3ds8.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class LedDBHelper extends SQLiteOpenHelper{
	public static final String DBNAME = "led8.db";
	public static final String TAB_DATAS_BASIC = "datas_basic";
	public static final String ITEM_ID = "id";
	public static final String ITEM_IDX_DATAS = "idx_datas";
	public static final String ITEM_INFO = "info";
	public static final String ITEM_USERNAME = "userName";

	public static final String TAB_DATAS_REAL = "datas_real";
	public static final String ITEM_DATAS = "datas";


	public static final String TAB_CONFIG = "userConfig";
	public static final String ITEM_CONFIG_NAME = "cfgName";
	public static final String ITEM_CONFIG_VALUE = "cfgValue";

	public LedDBHelper(Context context) {
		super(context, DBNAME, null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		final String create_datas_basic =
				"create table " + TAB_DATAS_BASIC +
				"(" +
				ITEM_ID + " bigint, "+
				ITEM_IDX_DATAS + " bigint, " +
				ITEM_INFO + " varchar(128),"+ 
				ITEM_USERNAME + " varchar(32))";
		db.execSQL(create_datas_basic);

		final String create_datas_Real =
				"create table " + TAB_DATAS_REAL +
				"( " + ITEM_ID + " bigint, "+
				ITEM_DATAS + " varchar(20480))";
		db.execSQL(create_datas_Real);

		final String create_config =
				"create table " + TAB_CONFIG +
				"(" + ITEM_CONFIG_NAME + " varchar(30), " +
					  ITEM_CONFIG_VALUE + " varchar(64))";
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {

	}
	@Override
	public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}

}
